package com.hushao.aimi.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.sql.Timestamp;

/**
 * @description: 用户角色关联
 * @author: 胡少
 * @create: 2018-06-03 17:52
 **/
@Data
@Entity
public class UserRole {
    @Id
    @GenericGenerator(name = "uuid",strategy = "uuid")
    @GeneratedValue(generator = "uuid")
    @Column(length = 32)
    private String id;

    @ApiModelProperty("用户id")
    @Column(length = 32,nullable = false)
    private String userId;

    @ApiModelProperty("角色id")
    @Column(nullable = false)
    private Integer roleId=1;

    @ApiModelProperty("创建时间")
    @CreationTimestamp
    private Timestamp createTime;

    @ApiModelProperty("更新时间")
    @UpdateTimestamp
    private Timestamp updateTime;

    @ApiModelProperty("备注")
    @Column(length = 512)
    private String comment;

    public UserRole(String userId, Integer roleId, String comment) {
        this.userId = userId;
        this.roleId = roleId;
        this.comment = comment;
    }
}

